home *** CD-ROM | disk | FTP | other *** search
- /* prt_ctl() */
- /* This function parses the string passed into a series of integers */
- /* separated by non-spaces, and sends each integer to the printer as */
- /* a printer control sequence. */
- #include <ctype.h>
- #include <stdio.h>
-
- prt_ctl(prt_code)
- char prt_code[];
- #define NULL 0
- #define SPACE 32
-
- {
- extern FILE *f1;
-
- char code[6];
- int length, c, num, x, y;
-
- length = strlen(prt_code);
- num = y = 0;
- setmem(code, 6, NULL);
-
- for (x=0; x <= length; x++) {
- if ((c=isdigit(prt_code[x])) > 0) {
- code[y] = prt_code[x];
- if ((++y) > 5) {
- code[y] = NULL;
- stcd_i(code, &num);
- fprintf(f1, "%c", num);
- setmem(code, 6, NULL);
- y = 0;
- }
- } else {
- if (prt_code[x] != SPACE) {
- if (y > 0) {
- code[y] = NULL;
- stcd_i(code, &num);
- fprintf(f1, "%c", num);
- setmem(code, 6, NULL);
- y = 0;
- }
- }
- }
- }
- }
-